package com.box.ai.pojo.vo;


import lombok.Data;
import org.springframework.ai.chat.messages.Message;

/**
 * spring ai 框架中封装的message提取出来
 * 这个里面的message封装的是各种消息的类型，比如user,assistant,system
 * 要将这种类型分离处理，只需要系统回复的消息和用户的消息
 */
@Data
public class MessageVO {
    private String role;
    private String content;
    //定义构造方法快速获取VO
    public MessageVO(Message message){
        switch (message.getMessageType()){
            case USER :
                role = "user";
                break;
            case ASSISTANT:
                role = "assistant";
                break;
            default:
                role = "";
                break;
        }
        this.content = message.getText();
    }
}
